/**
 * 类型系统模型
 *
 * Created by snowingsea on 2020/03/04.
 */
const mongoose = require('mongoose');
const schemaDefinition = require('./schema/file-type-system');
const schemaInstance = mongoose.Schema(schemaDefinition, { minimize: false });
// 存储key中含有半角的点类型
schemaInstance.pre('save', (next, options) => {
  options.checkKeys = false;
  next();
});
const modelInstance = mongoose.model('file-type-system', schemaInstance);
mongoose.connection.on('open', () => modelInstance.syncIndexes().catch(() => {}));
/**
 * Export model definition object.
 */
module.exports = modelInstance;
